package com.heima.comment.controller;


import com.heima.comment.service.ApCommentRepayService;
import com.heima.model.comment.dtos.ApCommentRepayDto;
import com.heima.model.comment.dtos.CommentRepayDTO;
import com.heima.model.comment.dtos.CommentRepayLikeDTO;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 评论评论的接口
 * </p>
 *
 * @author leon
 * @since 2024-11-26
 */

@Slf4j
@RestController
@RequestMapping("/api/v1/comment_repay")
public class ApCommentRepayController {

    @Autowired
    private ApCommentRepayService commentRepayService;


    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody ApCommentRepayDto dto) {
        log.info("提交评论 ：{}", dto);
        return commentRepayService.saveCommentRepay(dto);
    }

    /**
     * 查询评论回复列表
     */
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDTO dto) {
        return commentRepayService.loadCommentRepay(dto);
    }

    /**
     * 点赞
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult saveCommentRepayLike(
            @RequestBody CommentRepayLikeDTO dto) {
        return commentRepayService.saveCommentRepayLike(dto);
    }

}
